
<style scoped>
.node-panel {
  position: fixed;
  left: 30px;
  top: 80px;
  width: 125px;
  height: auto;
  min-height: 350px;
  border-radius: 5px;
  box-shadow: 0 0px 7px 1px rgba(1, 84, 120, .3);
  background: white;
  user-select: none;
}

.panel-title {
  width: 100%;
  height: 40px;
  line-height: 40px;
  text-align: center;
  color: var(--primary);
  border-bottom: solid 1px #F5F7FA;
}

.panel-list {
  padding: 0 20px;
}

.panel-list .list {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 40px;
  border-bottom: solid 1px #f9f9f9;
  cursor: pointer;
  color: #333;
}

.panel-list .list.panel-disabled {
  color: #9d9d9d;
  cursor: not-allowed;
}

.panel-list .list .iconfont {
  margin-right: 5px;
}
</style>

<template>
  <div class="node-panel">
    <div class="panel-title">
      操作控件
    </div>
    <div class="panel-list">
      <div :class="[item.class, 'list',  {'panel-disabled': item.disabled}]" v-for="(item, index) in panelList" :key="index" @click="rowClick(item)" @mousedown="$_dragNode(item)">
        <span :class="['iconfont', item.icon]"></span>
        <span>{{item.text}}</span>
      </div>
    </div>
  </div>
</template>

<script>


export default {
  name: 'NodePanel',
  props: {
    lf: Object,
    panelList: Array
  },
  data() {
    return {
      
    }
  },
  mounted() {
    // this.lf.extension.dndPanel.setPatternItems(this.panelList)
  },
  methods: {
    rowClick(item) {
      this.$emit('rowClick', item)
    },
    $_dragNode (item) {
      if (item.disabled) return false;
      this.$props.lf.dnd.startDrag({
        id: 4,
        type: item.type,
        properties: {
          name: "开工准备4",
          num: "4"
        }
      })
    }
  }
}
</script>
